<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>websocket</title>
    <script src="http://localhost:3000/socket.io/socket.io.js"></script>
</head>
<body>
    
    <script>
        
        let socket = io.connect('ws://localhost:3000/');
        
        // 客户端传递 服务端接收
        /* document.onclick = function () {
            socket.emit('d',10,2);
        } */

        // 客户端接收

        socket.on('d',(n)=>{
            console.log(n);
        });

    </script>
</body>
</html>